﻿using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;

namespace HelloWorld.Services
{
	[ServiceContract(Namespace="")]
	[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
	public class LocalizationService
	{
        //Methods

        /// <summary>
        /// Gets the localized resource value of the resource that has ResourceID equals to <paramref name="resourceID"/>.
        /// </summary>
        /// <param name="resourceID">Resource identifier.</param>
        /// <param name="langCode">Language code.</param>
        /// <returns>The localized resource value of the resource that has ResourceID equals to <paramref name="resourceID"/>.</returns>
        [OperationContract]
        public string GetResourceValue(String resourceID, String langCode)
        {
            String retVal = null;
            if ((!String.IsNullOrWhiteSpace(resourceID)) && (!String.IsNullOrWhiteSpace(langCode)))
            {
                retVal = ResourceManager.GetResourceValue(resourceID, langCode);
            }
            return retVal;
        }
	}
}
